package org.xyl.game.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.xyl.game.dao.MaproomDao;
import org.xyl.game.entity.Maproom;
import org.xyl.game.service.MaproomService;

@Service
public class MaproomServiceImpl implements MaproomService {
    @Autowired
    private MaproomDao maproomDao;

    @Override
    public Maproom createRoom(String username, double longitude, double latitude) {
        Maproom maproom = new Maproom();
        maproom.setOwner(username);
        maproom.setLatitude(latitude);
        maproom.setLongitude(longitude);
        Maproom save = maproomDao.save(maproom);
        return save;
    }

    @Override
    public Maproom joinRoom(int m) {
        return maproomDao.getById(m);
    }
}
